<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>动态展示列表</h1>
<ul id="city">

</ul>
<script type="text/javascript">
    var city_list = ["bj", "sh", "nj"];
    for (var city of city_list) {
        //往html中创建li标签
        var tag = document.createElement("li");
        //在li标签中写入内容
        tag.innerText = city;

        //将li标签添加都id为city的标签内
        var city_tag = document.getElementById("city");
        city_tag.appendChild(tag);
    }

</script>
</body>
</html>